package com.le.tester.javaThink.fifth.chapter14_StreamingProgramming;

import java.util.Random;
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
 * 描述：使用整数流创建更多的随机数
 */
public class StreamOfRandoms {
    static Random random = new Random(47);

    public static void main(String[] args) {
        Stream.of(1, 2, 3, 4, 5)
                .flatMapToInt(o -> IntStream.concat(random.ints(0, 100).limit(o), IntStream.of(-1)))
                .forEach(n -> System.out.format("%d ", n));
    }
}
